import {MicroAppModule} from "./MicroAppModule";
import {inject, provide} from "@peryl/react-compose";
import {iMicroPageServiceProvideData} from "@peryl/micro-web";

export const microAppUsePageService = MicroAppModule.createRegistration((microApp) => {

  microApp.usePageServiceProvider = (data) => {
    provide('@@PAGE_SERVICE_PROVIDER', data);
  };

  microApp.usePageService = () => {
    return inject<iMicroPageServiceProvideData>('@@PAGE_SERVICE_PROVIDER')!;
  };

});
